package com.ruoyi.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.system.domain.IOTData;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author wang
 * @version 1.0
 * @data 2024/3/25 下午 7:57
 * @desc 描述信息
 */
@Mapper
public interface IOTDataMapper extends BaseMapper<IOTData> {
    @Select("SELECT * FROM iot_data WHERE id IN (SELECT SUBSTRING_INDEX( group_concat( id ORDER BY `create_time` DESC ), ',', 1 ) FROM iot_data GROUP BY properties )")
    List<IOTData> selectFirstRecordForEachGroupUsingNativeSql();
}
